const app = express();
const path = require("path");
const cors = require("cors");
//发送一个html文件给到浏览器
//http://localhost:3000

//1. cors方案解决跨域
app.use(cors());
app.get("/d", (req, res) => {
  res.sendFile(path.resolve("./public/index.html"));
});
//负责跟浏览器沟通
app.get("/s", (req, res) => {
  console.log(100);
  res.send("这是服务器发送的内容");
});

app.listen(3000);

//npm i cors
//npm i express